package com.hkts.naturalgas.dictionaries.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.naturalgas.dictionaries.entity.HktsEnvironmentTemperature;
import com.hkts.naturalgas.dictionaries.mapper.HktsEnvironmentTemperatureMapper;
import com.hkts.naturalgas.dictionaries.service.IHktsEnvironmentTemperatureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yck
 * @since 2021-10-18
 */
@Service
@Transactional
public class HktsEnvironmentTemperatureServiceImpl extends ServiceImpl<HktsEnvironmentTemperatureMapper, HktsEnvironmentTemperature> implements IHktsEnvironmentTemperatureService {


    @Autowired
    private HktsEnvironmentTemperatureMapper hktsEnvironmentTemperatureMapper;

    @Override
    public IPage<HktsEnvironmentTemperature> selectPage(Page<HktsEnvironmentTemperature> page, HktsEnvironmentTemperature hktsEnvironmentTemperature) {
        QueryWrapper<HktsEnvironmentTemperature> query = Wrappers.query();
        QueryWrapper<HktsEnvironmentTemperature> entityWrapper = getEntityWrapper(query, hktsEnvironmentTemperature);
        return hktsEnvironmentTemperatureMapper.selectPage(page, entityWrapper);
    }


    @Override
    public List<HktsEnvironmentTemperature> selectList(HktsEnvironmentTemperature hktsEnvironmentTemperature) {
        QueryWrapper<HktsEnvironmentTemperature> query = Wrappers.query();
        QueryWrapper<HktsEnvironmentTemperature> entityWrapper = getEntityWrapper(query, hktsEnvironmentTemperature);
        return hktsEnvironmentTemperatureMapper.selectList(entityWrapper);
    }

    /**
     * 公共查询条件
     *
     * @param entityWrapper
     * @return
     */
    public QueryWrapper<HktsEnvironmentTemperature> getEntityWrapper(QueryWrapper<HktsEnvironmentTemperature> entityWrapper, HktsEnvironmentTemperature hktsEnvironmentTemperature) {
        //条件拼接

        return entityWrapper;
    }

    @Override
    public Map<String, HktsEnvironmentTemperature> selectMap() {
        QueryWrapper<HktsEnvironmentTemperature> query = Wrappers.query();
        List<HktsEnvironmentTemperature> hktsEnvironmentTemperatures = hktsEnvironmentTemperatureMapper.selectList(query);

        return null;
    }
}
